
$('.add_dog').on('click', function(){

	var html = '<div class="dog_profile">' + $('.dog_profile:first').html() + '</div>';
	var new_id = $('.dog_profile').length;

	$('input,textarea', html).each(function(){
		var name = $(this).attr('name').split('[').splice(0,1).join("");
		html = html.replace($(this).attr('name'), name+'['+new_id+']');
	});

	$('.dog_profile:last').after(html);
	$('.dog_profile:last .count span').text(new_id+1);
	$('.dog_profile:last input[type=text]').val('');
	$('.dog_profile:last textarea').text('');

	$('.dog_profile:last .radiochoice').each(function(){
		$(this).find('input:first').attr('checked', 'checked');
	})

	return false;
});